package com.hgyc.mom.mes.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hgyc.mom.common.vo.Result;
import com.hgyc.mom.core.mybatis.QueryWrapperUtil;
import com.hgyc.mom.mes.entity.MesStationCollectDetail;
import com.hgyc.mom.mes.service.MesStationCollectDetailService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 过站采集明细Controller
 *
 * @author fwj
 * @since 2025-07-04
 */
@Tag(name = "过站采集明细控制器", description = "过站采集明细控制器")
@RestController
@RequestMapping("/mes/station/collect/detail")
public class MesStationCollectDetailController {
    @Autowired
    private MesStationCollectDetailService mesStationCollectDetailService;


    @Operation(summary = "查询过站采集明细树列表", description = "查询过站采集明细树列表")
    @PostMapping("/list")
    public Result<List<MesStationCollectDetail>> pageList(@Parameter(description = "查询参数") @RequestBody MesStationCollectDetail mesStationCollectDetail) {
        QueryWrapper<MesStationCollectDetail> wrapper = QueryWrapperUtil.build(mesStationCollectDetail);
        List<MesStationCollectDetail> list = mesStationCollectDetailService.list(wrapper);
        return Result.success(list);
    }

    @Operation(summary = "获取过站采集明细详细信息", description = "获取过站采集明细详细信息")
    @GetMapping(value = "/{id}")
    public Result getInfo(@Parameter(description = "过站采集明细ID") @PathVariable("id") Long id) {
        return Result.success(mesStationCollectDetailService.getById(id));
    }

}